import { createWebHistory, createRouter } from 'vue-router'
import commonRoute from './modules/common'
const router = createRouter({
  history: createWebHistory(),
  routes: commonRoute,
  // 滚动行为
  scrollBehavior() {
    return {
      left: 0,
      top: 0,
    }
  },
})

router.afterEach((to, from) => {
  if (to.meta.title) {
    document.title = to.meta.title
  } else {
    document.title = 'VUE3 学习'
  }
})

export default router
